package com.wiscamp.ninechapters.panels.infrastructure.converters;


import com.wiscamp.ninechapters.panels.domain.entities.User;
import com.wiscamp.ninechapters.panels.infrastructure.po.UserPO;
import com.wiscamp.ninechapters.panels.infrastructure.views.UserView;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
        nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface UserConverter {
    UserConverter Instance = Mappers.getMapper(UserConverter.class);

    User toUser(UserPO po);

    User toUserByView(UserView view);

    UserPO toUserPO(User entity);

    UserPO toUserPO(User entity, @MappingTarget UserPO po);

}
